package com.lishe.lishe.lishe.module.mall.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.lishe.base.viewpager.MZViewHolder;
import com.lishe.lishe.Imageloader.ImageLoaderUtils;
import com.lishe.lishe.R;
import com.lishe.lishe.lishe.module.mall.bean.GoodsItemsBean;

/**
 * 标    题：
 * 功能描述：
 * 作    者：zouxx
 * 创建时间：2018/8/17
 */

public class BannerImageHolder implements MZViewHolder<GoodsItemsBean> {
    private ImageView simpleDraweeView;

    @Override
    public View createView(Context context) {
        //使用fresco，需要创建它提供的ImageView，当然你也可以用自己自定义的具有图片加载功能的ImageView
        simpleDraweeView = new ImageView(context);
        simpleDraweeView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        simpleDraweeView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        return simpleDraweeView;
    }

    @Override
    public void onBind(Context context, int position, GoodsItemsBean data) {
        ImageLoaderUtils.displayImage(context, data.imgUrl, simpleDraweeView, R.drawable.defalut_img);
    }
}
